package com.markpim.dena.opdracht3;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;


public class Data implements Comparable<Data> {
	
	//fields
	private List<Integer> position;
	private String word;
	
	//constructor
	public Data(int position, String word) {
		this.position = new ArrayList<Integer>();
		this.position.add(position);
		this.word = word;
	}
	
	@Override
	public int compareTo(Data d) {
		if(this.getWord() != null && d.getWord() != null) {
			return this.getWord().compareTo(d.getWord());
		}
		return 0;
	}

	//getters and setters
	public int getFreq() {
		return position.size();
	}

	public List<Integer> getPosition() {
		return position;
	}

	public void addPosition(int position) {
		this.position.add(position);
	}

	public String getWord() {
		return word;
	}
}
